package com.example.any_testdemo.sqliteDemo

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import com.example.any_testdemo.AnyConstants

class TestSqliteOpenHelper(
    context: Context?,
    name: String?,
    factory: SQLiteDatabase.CursorFactory?,
    version: Int
) : SQLiteOpenHelper(context, name, factory, version) {

    constructor(context: Context?, name: String?, version: Int) : this(context, name, null, version)

    constructor(context: Context?, name: String?) : this(context, name, AnyConstants.SQLITE_VERSION)

    override fun onCreate(db: SQLiteDatabase?) {
        println("onCreate db")
        val sql = "create table person(id Integer primary key autoincrement,name varchar(200),sexType Integer)"
        db?.execSQL(sql)
    }

    override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {

    }
}